package com.jessica.demo;

import java.awt.*;

public class AppletInOut extends Frame {
    Label prompt;
    TextField input;
    Label output;


    AppletInOut() {
        this.setSize(300, 300);

        prompt = new Label("Please enter your name: ");
        input = new TextField(6);
        output = new Label();

        prompt.setBounds(30, 30, 200, 30);
        input.setBounds(30, 70, 200, 30);
        output.setBounds(30, 150, 200, 30);

        this.add(prompt);
        this.add(input);
        this.add(output);

        input.addActionListener(e -> {
            output.setText(input.getText() + ", welcome!");
        });

        this.setVisible(true);
    }

    public static void main(String[] args) {
        AppletInOut f = new AppletInOut();
    }
}
